package dao;

import java.io.Serializable;
import java.util.List;

import modelo.Barrio;
import modelo.Caracteristicaxsalon;
import modelo.Localidad;
import modelo.Provincia;
import modelo.Tiposuscripcion;

import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;

import util.HibernateUtil;

public class CaracteristicaxSalonDao implements Serializable{

	private static final long serialVersionUID = 2373395527733357132L;
	private Session session;
	SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
	
	public CaracteristicaxSalonDao() {
		super();
	}
	
	public List<Caracteristicaxsalon> obtenerCaracteristicas() {
		session=sessionFactory.openSession();
		
		Query query = session.createQuery("SELECT c FROM Caracteristicaxsalon c");
		List<Caracteristicaxsalon> c = query.list();
		
		session.close();
		
		return c;
	}
	
	public List<Caracteristicaxsalon> obtenerCaracteristicaxSalon(int idSalon) {
		session=sessionFactory.openSession();

//			Query query = session.createQuery("SELECT s FROM Servicioadicionalxsalon s");
		Criteria cr = session.createCriteria(Caracteristicaxsalon.class);
		cr.add(Restrictions.eq("salon.idSalon", idSalon));
		List<Caracteristicaxsalon> ca= cr.list();
		session.close();

		return ca;
		}


	}
